import {
  getAction,
  deleteAction,
  putAction,
  putparamsAction,
  postAction,
  httpAction,
} from "@/api/manage";

const productOrderList = (params) =>
  getAction("/mess/messProductOrder/list", params); // 查询生产工单列表
const messReceiveMaterialApplyQueryByOrderId = (params) =>
  getAction("/mess/messReceiveMaterialApply/queryByOrderId", params); //  根据订单查可领物料-领料

const messRemedyMaterialApplyQueryByOrderId = (params) =>
  getAction("/mess/messRemedyMaterialApply/queryByOrderId", params); //  根据订单查可领物料-补料

const messReturnMaterialApplyQueryByOrderId = (params) =>
  getAction("/mess/messReturnMaterialApply/queryByOrderId", params); //  根据订单查可领物料-退料
// 领用
const messReceiveMaterialApplyAdd = (params) =>
  postAction("/mess/messReceiveMaterialApply/add", params);

// 领用单详情
const messReceiveMaterialApplyQueryById = (params) =>
  getAction(`/mess/messReceiveMaterialApply/queryById?id=${params}`);

// 申请补料
const messRemedyMaterialApplyAdd = (params) =>
  postAction("/mess/messRemedyMaterialApply/add", params);
// 补料详情
const messRemedyMaterialApplyQueryById = (params) =>
  getAction(`/mess/messRemedyMaterialApply/queryById?id=${params}`);
// 申请退料
const returnMaterialAdd = (params) =>
  postAction("/mess/messReturnMaterialApply/add", params);
const returnMaterialQueryById = (params) =>
  getAction(`/mess/messReturnMaterialApply/queryById?id=${params}`);

// 合格品入库申请详情
const qualifiedInApplyQueryById = (params) =>
  getAction(`/mess/messQualifiedInboundApply/queryById?id=${params}`);
// 客户详情
const erpCustomerQueryById = (params) => getAction(`/salemgt/erpCustomer/queryById?id=${params}`) // 详情

// 物品详情
const goodsQueryById = (params) => getAction(`/wms/goods/queryById?id=${params}`)
// 仓库详情
const wmsWarehouseQueryById = (params) => getAction(`/wms/wmsWarehouse/queryById?id=${params}`) // 详情

// 盘点
const wmsWarehouseInventoryAdd = (params) => postAction('/wms/wmsWarehouseInventory/add', params) // 新建
const wmsWarehouseInventoryEdit = (params) => putAction('/wms/wmsWarehouseInventory/edit', params) // 编辑
const wmsWarehouseInventoryUpdateStatus = (params) => putAction('/wms/wmsWarehouseInventory/updateStatus', params) // 盘点完毕
const warehouseInventoryGetContinueInventoryInfo = (params) => getAction(`/wms/wmsWarehouseInventory/getContinueInventoryInfo?id=${params}`) // 继续盘点 查上面基本信息

const getWmsInventoryGoodsList = (params) => getAction('/wms/wmsWarehouseInventory/getWmsInventoryGoodsList', params) // 列表 详情 表格 接口

// 工单详情
const produceOrderInfoQueryById = (params) => postAction(`/jksaas-produce/produce/produceorder/produceOrderInfo/list`, params)
// 生产任务列表
const produceOrderTaskList = (params) => postAction(`/jksaas-produce/produce/produce/produceOrderTask/list`, params)
// 生产报工列表
const produceOrderReportWorkList = (params) => postAction(`/jksaas-produce/produce/reportwork/produceOrderReportWork/list`, params)
// 修改工单状态
const updateOrderStatus = (params) => getAction(`/jksaas-produce/produce/produceorder/produceOrderInfo/updateOrderStatus`, params)
// 撤回工单
const revocation = (params) => postAction(`/jksaas-produce/produce/produceorder/produceOrderInfo/revocation`, params)
// 删除工单
const produceOrderInfoDelete = (params) => deleteAction(`/jksaas-produce/produce/produceorder/produceOrderInfo/delete`, params)

export const materialFormApi = {
  productOrderList,
  messReceiveMaterialApplyQueryByOrderId,
  messRemedyMaterialApplyQueryByOrderId,
  messReturnMaterialApplyQueryByOrderId,
  messReceiveMaterialApplyAdd,
  messReceiveMaterialApplyQueryById,
  messRemedyMaterialApplyAdd,
  messRemedyMaterialApplyQueryById,
  returnMaterialAdd,
  returnMaterialQueryById,
  qualifiedInApplyQueryById,
  erpCustomerQueryById,
  goodsQueryById,
  wmsWarehouseQueryById,
  wmsWarehouseInventoryAdd,
  wmsWarehouseInventoryEdit,
  wmsWarehouseInventoryUpdateStatus,
  warehouseInventoryGetContinueInventoryInfo,
  getWmsInventoryGoodsList,
  produceOrderInfoQueryById,
  produceOrderTaskList,
  produceOrderReportWorkList,
  updateOrderStatus,
  revocation,
  produceOrderInfoDelete
};
